import time
DEFAULT_TIMEOUT = 6
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.remote.webdriver import WebElement

class A3mall():
    def __init__(self,driver):
        self.driver = driver

    def goto(self,url):
        self.driver.get(url)

    def wait_clickable(self,locator,timeout=None) -> WebElement:
        timeout=DEFAULT_TIMEOUT if timeout is None else timeout
        wb = WebDriverWait(self.driver,timeout=timeout)
        return wb.until(expected_conditions.visibility_of_element_located(locator))

    def click(self,locator):
        el = self.wait_clickable(locator)
        el.click()

    def fill(self,locator,text):
        el = self.wait_clickable(locator)
        el.send_keys(text)

    def sleep(self,times):
        time.sleep(times)






